package com.kaka.bus.adapter;

import android.app.Activity;
import android.support.annotation.Nullable;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.kaka.bus.R;
import com.kaka.bus.bean.DrainageBean;

import java.util.List;

/**
 * Created by zhangqi on 2017/11/22.
 */

public class DrainageAdapter extends BaseQuickAdapter<DrainageBean, BaseViewHolder> {

    private final String RECOMMEND = "1";
    private final String ACTIVITY = "2";

    private Activity mActivity;
    public DrainageAdapter(Activity activity, int layoutResId, @Nullable List<DrainageBean> data) {
        super(layoutResId, data);
        mActivity = activity;
    }

    @Override
    protected void convert(BaseViewHolder helper, DrainageBean item) {

        helper.setText(R.id.item_drainage_title,item.getDrainage_name())
                .setText(R.id.item_drainage_tips,item.getDrainage_title())
                .setText(R.id.item_drainage_des,item.getDrainage_des());

        ImageView img = helper.getView(R.id.item_drainage_img);
        Glide.with(mActivity)
                .load(item.getDrainage_img())
                .into(img);

        if(RECOMMEND.equals(item.getDrainage_type())){
            helper.setImageResource(R.id.item_draginage_rightimg,R.mipmap.personal_information_tuijian);
        }else if(ACTIVITY.equals(item.getDrainage_type())){
            helper.setImageResource(R.id.item_draginage_rightimg,R.mipmap.personal_information_huodong);
        }else{

        }
    }
}
